<template>
  <div>
    <ul>
      <li v-for="(a, b) in list" :key="b">
        <span style="margin:5px"> {{ a }}</span>
        <button @click="delBtn(b)">删除</button>
      </li>
    </ul>
    <button @click="addBtn">生成</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: [1, 5, 3],
    }
  },
  methods: {
    addBtn() {
      this.list.push(Math.floor(Math.random()*100))
    },
    delBtn(i){
      this.list.splice(i,1)
    }
  },
}
</script>

<style></style>
